GBML manual / Motion

speed

Speed along `direction`, in pixels per frame.

Syntax

speed: real

Description

How fast this instance moves along direction, in pixels a frame. Setting both together is the natural shape for anything that thinks in terms of an angle - aim at a target, then go - rather than separate horizontal/vertical components.

See hsp's own note for exactly how speed/direction and hsp/vsp interact, and why an instance that retargets speed/direction to a genuinely new value every frame should not also expect gravity to accumulate on top of it.

Example

speed = 4;
direction = 0;

A bolt fired straight east at a fixed 4 pixels a frame, set once when it is created.

On the GBA

See hsp’s own note for exactly how this interacts with hsp/vsp and gravity.

See also: directionhspvsp